<?php

namespace app\api\validate;

use think\Validate;
/**
 *
 * 未完成
 */
class GoodsScene extends Validate
{
    protected $rule = [
        'id' => ["require","number"],
        'goods_name' => ['require','length'=>'2,60'],
        'goods_imgs' => ['require'],
        'is_top' => ['require','number'],
        'goods_class' => ['require','number'],
        'goods_brand' => ['require','number'],
        'depot_id' => ['require','number'],
        'status' => ['require','number'],
        "data_state" => ['number','require'],
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'goods_name.require' => '商品名称不能为空',
        'goods_name.length' => '仓库名长度为2-60个字符',
        'goods_imgs.require' => '商品图集不能为空',
        'is_top.require' => '是否置顶不能为空',
        'is_top.number' => '是否置顶只能为数值',
        'goods_class.require' => '商品分类不能为空',
        'goods_class.number' => '商品分类只能为数值',
        'goods_brand.require' => '商品品牌不能为空',
        'goods_brand.number' => '商品品牌只能为数值',
        'depot_id.require' => '请选择仓库',
        'depot_id.number' => '仓库必须为数值',
        'status.require' => '上架状态不能为空',
        'status.number' => '上架状态必须为数值',
        'id.require.' => 'ID不能为空',
        'id.number' => 'ID只能为数值',
        'data_state.number' =>'数据状态必须为数值',
        'data_state.require' =>'未设置状态',
    ];
    protected $scene = [
        'add'  =>  ['goods_name','goods_imgs','is_top','goods_class','goods_brand','depot_id','status'],
        'update'  =>  ['id','goods_name','goods_imgs','cost_price','agency_price','retail_price','goods_class','goods_brand','depot_id'],
        'update_state' => ['id',"data_state"],
        'update_status' => ['id','status'],
        'update_is_top' => ['id','is_top'],
    ];
}